package com.pocketsweet.ui.fragments;

import com.lidroid.xutils.ViewUtils;
import com.lidroid.xutils.view.annotation.ViewInject;
import com.pocketsweet.R;
import com.pocketsweet.service.UserService;
import com.pocketsweet.ui.uilib.MyBitmapFactory;
import com.pocketsweet.ui.uilib.MyViewPager;
import com.pocketsweet.ui.uilib.myTextViewShow;
import com.squareup.picasso.Picasso;

import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;

public class WelcomeOne extends Fragment {
	@ViewInject(R.id.mtvShow)
	private myTextViewShow mtvShow;

	@ViewInject(R.id.welcome1)
	private ImageView welcome1;
	//
	private boolean isShow = false;

	@Override
	public View onCreateView(LayoutInflater inflater, ViewGroup container,
			Bundle savedInstanceState) {
		View rootView = inflater.inflate(R.layout.fragment_welcome_1, null);
		ViewUtils.inject(this, rootView);
		return rootView;
	}

	@Override
	public void onActivityCreated(Bundle savedInstanceState) {
		super.onActivityCreated(savedInstanceState);
//		textShow();
		// welcome1.setImageBitmap(MyBitmapFactory
		// .decodeSampledBitmapFromResource(getResources(),
		// R.drawable.welcome1, 260, 596));
		UserService.displaySplashImage(R.drawable.welcome1, welcome1);
		// Picasso.with(getActivity()).load(R.drawable.welcome1).into(welcome1);
		// welcome1.setImageDrawable(getResources().getDrawable(R.drawable.welcome1));
	}

	public void textShow() {
		if (isShow == false) {
			isShow = true;
			mtvShow.startShow();
		} else {
			mtvShow.setText(mtvShow.getTextString());
		}
	}

	@Override
	public void onResume() {
		super.onResume();
	}

	@Override
	public void onStop() {
		super.onStop();

	}

	@Override
	public void onDestroy() {
		super.onDestroy();
		releaseImageViews();

	}

	private void releaseImageViews() {
		MyBitmapFactory.releaseImageViewResouce(welcome1);
	}
}
